<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||	
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws. 
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.). 
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations). 
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Account/classes/PhpFox_ComponentInfoActivity.class.php, $Author:  $ */



/** User info/actibity block
 * 
 * Parameters:
 *  1. oUser (mandatory) - user account object
 * 
 * @package module.account
 * @version $Id: PhpFox_ComponentInfoActivity.class.php 321 2008-02-14 07:06:51Z phpfoxsv $
 *   
 */
class PhpFox_Mod_Account_ComponentInfoActivity extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
	    $oAcc = $this->getParam('oUser');
	    assert($oAcc != null);
	    $oSrvAcc = &$this->_oModule->getService('Account');
	    /* @var $oSrvAcc PhpFox_Mod_Account_ServiceAccount */
	    
	    $oSecurityService = &App::getModuleService('Account', 'Security');
        /* @var $oSecurityService PhpFox_Mod_Account_ServiceSecurity */
        
	    $oAcc->aData['membership'] = $oSecurityService->getMembership($oAcc);  
	    $aMembershipData = $oSecurityService->getMembershipData($oAcc->aData['membership']);
	    $oAcc->aData['is_special'] = $aMembershipData['is_special'];    
	    
		$oAcc->aData['used_space'] = $oSrvAcc->getUsedSpace($oAcc->aData['user']);
		
		if ( !App::getSetting('profile_display_points') )
		{
			$iTotalPoints = $oSrvAcc->getUserPoints($oAcc);
   		    $aStars = $oSrvAcc->getStarsAsArray($iTotalPoints);
   		    $iPoints = $iTotalPoints;
   		 }

        if((strtotime($oAcc->aData['last_payment'])-time())>315360000) // 10 years
        {
        	$oAcc->aData['oneTimePayMembership']='Yes';
        }             

		$oTpl = &$this->_oModule->getTemplate();
		$oTpl->assign(array(
		    'aUser'     => $oAcc->aData,
		));
		
		$oTpl->assignSrc(array(
			'sUserPicPath'     => App::getParam('user.pic.url'),
			'sMembershipImage' => $oSrvAcc->getMembershipImageSecure($oSecurityService,$oAcc),
			'iPoints'          => isset($iPoints) ? $iPoints : '',
		    'aStars'           => isset($aStars) ? $aStars : '',
		    'bShowPoints'      => !App::getSetting('profile_display_points'),
		));			
		$srcHtml = $oTpl->fetch('InfoActivity.html');
		return $srcHtml;
	}

}
?>